﻿@using Ed.Entity
@using Ed.Web.Helpers
@model  List<Dictionary<string, object>>
@{
    Layout = null;
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>雪绒花 - 手机登录页面</title>
    <script type="text/javascript">        //手机机型适配
        if (/Android (\d+\.\d+)/.test(navigator.userAgent)) {
            var version = parseFloat(RegExp.$1);
            if (version > 2.3) {
                var phoneScale = parseInt(window.screen.width) / 640;
                document.write('<meta name="viewport" content="width=640, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
            } else {
                document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
            }
        } else {
            document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
        }</script>

    <link href="/Themes/default/lib/artDialog/css/ui-dialog.css" rel="stylesheet" />
    <link href="/Themes/default/lib/poshytip/tip-yellow/tip-yellow.css" rel="stylesheet" />
    <script src="/Themes/default/lib/jquery/jquery-1.11.1.js"></script>
    <script src="/Themes/default/lib/artDialog/dist/dialog-plus-min.js"></script>
    <script src="/Themes/default/lib/validate/jquery.validate.min.js"></script>
    <script src="/Themes/default/lib/validate/jquery.validate.extend.js"></script>
    <script src="/Themes/default/lib/validate/messages_cn.js"></script>
    <script src="/Themes/default/lib/cookie/jquery.cookie.js"></script>
    <script src="/Themes/default/lib/poshytip/jquery.poshytip.min.js"></script>
    <script src="/Themes/default/lib/function.js"></script>
    <script type="text/javascript">
        $(function () {
            //表单验证
            $("#loginForm").validate({
                rules: {
                    userName: {
                        rangelength: [5, 20]//,
                    }
                },
                userPassword: {
                    rangelength: [6, 20]//,
                },
                messages: {
                    userName: {
                        required: "用户名不能为空！",
                        rangelength: "用户名6-20位",
                        remote: "该用户名不存在！"
                    },
                    userPassword: {
                        required: "密码不能为空！",
                        rangelength: "密码长度必须在6-20之间",
                        remote: "密码错误！"
                    }
                },
                focusInvalid: true,
                errorPlacement: function (error, element) {
                    var errorMsg = error[0].innerHTML;
                    var elementName = element[0].name;
                    $("#" + elementName).formtip(errorMsg);
                },
                success: function (element) {
                    var elem = $(element)[0].htmlFor;
                    $("#" + elem).poshytip('disable');
                    $("#" + elem).poshytip('destroy');
                }
            });
            //登录
            do_login();
        });
        //登录提交
        function do_login() {
            $("#btnSubmit").click(function () {
                //集成jquery validate   
                if (!$("#loginForm").valid()) {
                    return false;
                } else {
                    var userName = $.trim($("#userName").val());
                    var userPassword = $.trim($("#userPassword").val());
                    login_ajax(userName, userPassword);
                    return false;
                }
            });
        }

        function login_ajax(userName, userPassword) {

            var url = "/Account/Login/DoLogin";
            var type = "normal";
            var accountType = get_account_type(userName);
            var clientIp = "";
            var clientPlace = "";
            var clientTime = get_client_time();
            var remember = false;
            $.ajax({
                type: "post",
                url: url,
                data: { type: type, accountType: accountType, userName: userName, userPassword: userPassword, remember: remember, clientIp: clientIp, clientPlace: clientPlace, clientTime: clientTime },
                dataType: "json",
                beforeSend: function () {
                    showTopContentDialog("login_loding", "<section class='dialog_loading'>正在登录中，请稍后...</section>", "登陆提示", 400, 75);
                },
                complete: function () {
                },
                success: function (data) {                 
                    if (data.Status) { //登录成功
                        top.dialog.list["login_loding"].close().remove();
                        showTopDialog("show_loading", "<section class='dialog_loading'>登陆成功,页面加载中，请稍后...</section>", "温馨提示", 400, 95);
                        setTimeout(function () {
                            top.dialog.list["login_loding_error"].close().remove();
                        }, 1000);
                        tiaozhuan();
                    } else {
                        top.dialog.list["login_loding"].close().remove();
                        showTopContentDialog("login_loding_error", "<section class='dialog_error'>" + data.Msg + "</section>", "登录出错", 400, 75, false);
                        setTimeout(function () {
                            top.dialog.list["login_loding_error"].close().remove();
                        }, 1000);
                    }
                },
                error: function () {
                    top.dialog.list["login_loding"].close().remove();
                    //showMsg("登陆失败,请联系管理员！", "Error");
                    showTopContentDialog("login_loding_error", "<section class='dialog_error'>网络连接错误！</section>", "登录出错", 400, 75);
                    setTimeout(function () {
                        top.dialog.list["login_loding_error"].close().remove();
                    }, 1000);
                }
            });
            //必须有这个阻止表单提交
            return false;
        }
        function tiaozhuan() {
            var url = window.location.href;
            location.href = "/Order/YuesaoOrder/MobileAddYuesao";
        }
        function get_account_type(userName) {
            var reg_email = /^\w+@@[a-z0-9]+\.[a-z]+$/i;
            var reg_phone = /^[1]+[3,5]+\d{9}$/;
            if (reg_email.test(userName)) {
                return "email";
            } else if (reg_phone.test(userName)) {
                return "phone";
            } else {
                return "username";
            }
        }
    </script>
</head>
<body>
<header>
    <section class="title">雪绒花登录</section>
</header>
    <!--固定顶部部分 结束-->
    <section class="xrhdl">
        <section class="ll-book-container">
            <section class="ll-book-top">
                <section class="ll-logo-area">
                    <img width="219" height="105" src="/Themes/default/home/images/logo.png" alt="雪绒花云服务">
                    <p class="logo-con">
                    </p>
                    <p class="logo-intro" id="logo-intro">
                        随时随地，找到最适合你的月嫂</p>
                </section>
                <section class="form-container" id="form_container">
                    <section class="ng-form-area show-place" id="form-area">
                        <form method="post" id="loginForm">
                        <section class="shake-area" id="shake_area" style="z-index: 30;">
                            <section class="enter-area">
                                <input type="text" class="enter-item first-enter-item required" id="userName" name="userName">
                            </section>
                            <section class="enter-area" style="z-index: 20;">
                                <input type="password" class="enter-item last-enter-item required" id="userPassword"
                                    name="userPassword">
                            </section>
                        </section>
                        <input id="btnSubmit" class="enter-item dlan" type="submit" value="立即登录">
                        </form>
                    </section>
                </section>
            </section>
        </section>
    </section>
    <!--主页主题部分 开始-->

    <style type="text/css">
    body{background: #ececec;width: 640px;margin: 0 auto;background-color: #074057;}
.xrhdl input {
width: 80%;
height: 50px;
}
body, button, input, select, textarea, td, th {
color: #333;
font: 26px/39px \5FAE\8F6F\96C5\9ED1, Helvetica, STHeiTi, sans-serif,Arial;
outline: none;
}
header {
height: 88px;
line-height: 88px;
background: #100C41;
position: relative;
}
header .title {
line-height: 88px;
position: relative;
z-index: 1;
color: #FFF;
font-size: 36px;
text-align: center;
}
.xrhdl {
width: 100%;
font-family: "微软雅黑";
font-size: 14px;
color: #333;
padding: 20px 0px;
}
.xrhdl input.dlan {
width: 90%;
height: 80px;
background-color: #110A3F;
color: #FFF;
border: none;
padding: 20px 10px;
cursor: pointer;
font-size:35px;
}

.ll-logo-area {
height: 280px;
overflow: hidden;
position: relative;
margin-top:85px;}

.ll-logo-area img {
margin: 0 auto;
display: block;
}

.ng-form-area {display:block!important; padding-top: 10px; height:280px; margin:0 auto; position: relative;min-height: 120px; height: auto; }
.shake-area{position: relative;}
input:focus {outline:none;}
.enter-area {position: relative; margin-bottom: 50px;}
.enter-item {background: #235376; border: 1px solid #598fab; width:80%; display: block; height: 19px; line-height: 19px; padding:11px 20px; margin: 0px auto;
border-radius: 22px; color: #f0f4f6;font-weight: bold; margin:0px auto;}
.enter-item:focus {background: #11466b; border: 1px solid #598fab;}
.orange {display:block; margin:0; border:0 none; background:none; position: absolute; 
top:73px; right:4px; z-index: 10; width: 44px; height: 44px; z-index: 60;
border-radius: 0 3px 3px 0; text-indent: 200px; overflow: hidden;}
.logo-intro{ text-align:center; color:#fff; font-size:28px; font-family:"微软雅黑";}
    </style>
</body>
</html>
